<template>
  <div>
    <div class="text-center m-3">
      <input v-model="title">
    </div>
    <div class="m-3">
      <textarea v-model="content" style="width: 100%;" rows="10">
      </textarea>
    </div>
    <div class="m-3">
      <button @click="save">保存</button>
    </div>
  </div>
</template>

<script>
import {ProveApi} from "@/api/api";
import {postJson} from "@/api/http";

export default {
  name: "EditComponent",
  data() {
    return {
      id: this.$route.query.id,
      title: this.$route.query.value,
      content: "",
    }
  },
  methods: {
    async save() {
      let data = {
        parent_id: this.id,
        value: this.content
      }
      let res = await postJson(ProveApi+"/"+ 0, data);
      if (res.code === 1) {
        this.$message.success('操作成功');
        this.$router.back()
      }
    }
  },
}
</script>

<style scoped>

</style>